package com.citcc.business.service;

import com.citcc.business.bean.CdzStation;
import com.citcc.business.bean.PositionModel;
import com.citcc.business.bean.vo.CdzStationVo;
import com.citcc.business.mapper.CdzGunMapper;
import com.citcc.business.mapper.CdzStakeMapper;
import com.citcc.business.mapper.CdzStationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CdzStationService {

    private final CdzStationMapper cdzStationMapper;
    private final CdzStakeMapper cdzStakeMapper;

    @Autowired
    public CdzStationService(CdzStationMapper cdzStationMapper,CdzStakeMapper cdzStakeMapper){
        this.cdzStationMapper=cdzStationMapper;
        this.cdzStakeMapper=cdzStakeMapper;
    }

    public List<CdzStation> selectCdzStationAll(CdzStation station) {
        return cdzStationMapper.selectCdzStationAll(station);
    }

    public int insert(CdzStation record) {
        return cdzStationMapper.insertSelective(record);
    }

    public int update(CdzStation record) {
        return cdzStationMapper.updateByPrimaryKeySelective(record);
    }

    public int delete(String id){
        return cdzStationMapper.deleteByPrimaryKey(id);
    }

    public CdzStation getCdzStation(String id) {
        return cdzStationMapper.selectByPrimaryKey(id);
    }

    public List<CdzStationVo> getStationListByRadii(PositionModel aroundLocation) {
        return cdzStationMapper.getStationListByRadii(aroundLocation);
    }

    public CdzStationVo getStationById(String stationId) {
        return cdzStationMapper.getStationById(stationId);
    }

    public CdzStation getByGunIdAndStakeCode(String cdqId,String code){
        return cdzStationMapper.getByGunIdAndStakeCode(cdqId,code);
    }
}
